using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;

using Redboil.Bfp.Core;
using Redboil.Bfp.Web.Services;
using System.Web.Routing;
using System.Web.Mvc;
using System.ServiceModel.Activation;

namespace Redboil.Bfp.Web {
    public class Global : HttpApplication {
        private Container container;

        protected void Application_Start(object sender, EventArgs e) {
            //RouteCollection routeCollection = new RouteCollection();
            //routeCollection.MapRoute(
            //    "Default",
            //    "{controller}/{action}/{paramaters}",
            //    new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            //);
            RouteTable.Routes.Add(new ServiceRoute("SampleService", new WebServiceHostFactory(), typeof(SampleService)));
            RouteTable.Routes.Add(new ServiceRoute("AuthenticationService", new WebServiceHostFactory(), typeof(AuthenticationService)));
            container = Container.Instance;
        }

        protected void Session_Start(object sender, EventArgs e) {

        }

        protected void Application_Error(object sender, EventArgs e) {
            //Server.Transfer("~/Error.aspx");
        }

        protected void Session_End(object sender, EventArgs e) {

        }

        protected void Application_End(object sender, EventArgs e) {
            container.Dispose();
        }
    }
}